#!/bin/bash
cpu_num=`/bin/cat /proc/cpuinfo |grep physical\ id|sort|uniq|wc|awk '{print $1}'`
percpu_cores=`cat /proc/cpuinfo |grep cpu\ cores|uniq|awk '{print $NF}'`
total_cores=`echo "$cpu_num*$percpu_cores"|bc`
#echo "$cpu_num*$percpu_cores $total_cores"

threshold=`echo "$total_cores*5"|bc`  #5 times
#thresholdW=`echo "$total_cores*2"|bc`  #2 times

/usr/lib64/nagios/plugins/check_load -w $threshold,$threshold,$threshold -c $threshold,$threshold,$threshold
Exit=$?


#date >> /usr/lib64/nagios/plugins/load_ps.log
#ps -ef | awk '{print $1}' |sort |uniq -c |sort -nr -k 1 >> /usr/lib64/nagios/plugins/load_ps.log
#ps -ef | awk '{print $8}' |sort |uniq -c |sort -nr -k 1 >> /usr/lib64/nagios/plugins/load_ps.log
#ps -aux >> /usr/lib64/nagios/plugins/load_ps.log

#/bin/rm -f /usr/lib64/nagios/plugins/load_ps.log

#/usr/lib64/nagios/plugins/check_load -w $thresholdW,$thresholdW,$thresholdW -c $threshold,$threshold,$threshold

exit $Exit
